package day1119;

import java.util.Scanner;

public class Demo9 {
    public static void main(String[] args) {
        String      nameReg="^[a-zA-Z][a-zA-Z0-9_]{2,19}$";//表示用户名的格式
        String  userName="";
        Scanner sc=new Scanner(System.in);
        while(1<2) {
            userName = sc.next();   //next()
            if (userName.matches(nameReg)) {
                break;
            }
            System.out.println("您设定用户名不符合规则");
        }
        System.out.println("您设定用户名可用");
    }
}
